package com.duguo.dynamicmvc.factory.processor.model;

import java.util.List;
import java.util.Map;

import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtPrimitiveType;

import com.duguo.dynamicmvc.factory.ControllerFactory;

public interface ModelValidationCreator {

	public boolean hasValidationException(CtMethod ctMethod) throws Exception;

	public boolean hasValidationException(CtClass modelImplCtClass) throws Exception;

	public void addValidationExceptionStart(StringBuffer methodBody, StringBuffer validationException, boolean hasException);

	public void addValidationExceptionEnd(String fieldName, StringBuffer methodBody, boolean hasException);

	public void addNumberFomratValidator(ControllerFactory controllerFactory, String fieldName, StringBuffer methodBody, boolean isNumber, CtPrimitiveType fieldPrimitiveType, CtClass modelImplCtClass, Map<String, CtClass> usedParams, CtMethod controllerMethod, Map<String,Object> staticObjects) throws Exception;

	public void addNoneRequiredValidators(ControllerFactory controllerFactory, String fieldName, CtClass modelImplCtClass, Map<String, CtClass> usedParams, StringBuffer methodBody, CtMethod controllerMethod, Map<String,Object> staticObjects, List validators, ModelAnnotationReader modelAnnotationReader) throws Exception;

	public void addThrowValidationException(StringBuffer validationException, StringBuffer methodBody);

	public void addRequiredValidator(ControllerFactory controllerFactory, String fieldName, CtClass modelImplCtClass, Map<String, CtClass> usedParams, StringBuffer methodBody, CtMethod controllerMethod, Map<String,Object> staticObjects, List validators, ModelAnnotationReader modelAnnotationReader) throws Exception;
	

}
